﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Threading;
using CPGVertragsverwaltung.ErrorHandling;

namespace CPGVertragsverwaltung
{
    static class Program
    {
        /// <summary>
        /// Der Haupteinstiegspunkt für die Anwendung.
        /// </summary>
        [STAThread]
        static void Main()
        {
            //Add Exception Handler
            Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(MyExceptionHandler);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new frmMainWindow());
        }

        static void MyExceptionHandler(object pObject, ThreadExceptionEventArgs pArgs)
        {
            ExceptionWindow myExceptionWindow = new ExceptionWindow();
            myExceptionWindow.Exception = pArgs.Exception;
            myExceptionWindow.ShowDialog();
            Application.Exit();
        }
    }
}